o/snapstate: set UserID for download-component task - #17020
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses LP2110368 by ensuring component downloads can use user authentication when required (e.g., for private snaps). It does so by propagating an appropriate UserID into the SnapSetup used by component-related tasks, and adds tests to verify authenticated vs unauthenticated download behavior and the precedence rules for selecting the user ID.
Changes:
- Set
SnapSetup.UserIDduringInstallComponentsusing existinguserIDForSnap(...)selection logic (snap state user ID preferred, otherwise install opts). - Add a new unit test covering
download-componentbehavior when a valid authenticated user is provided. - Extend component install tests to validate
UserIDselection/precedence betweenSnapState.UserIDandOptions.UserID.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
overlord/snapstate/handlers_components_download_test.go |
Adds coverage to ensure component downloads pass store user auth (macaroon) when SnapSetup.UserID is set. |
overlord/snapstate/component.go |
Propagates a resolved UserID into SnapSetup for component installation task chains. |
overlord/snapstate/component_install_test.go |
Adds tests to assert correct UserID precedence and propagation into the setup-profiles task snap-setup. |
|
Fri May 8 08:53:15 UTC 2026 Failures:Preparing:
Executing:
Restoring:
Skipped tests from snapd-testing-skipIf you wish to have any of the below tests run in your PR, in your PR description, add 'unskip:' followed by a copy-and-pasted list (without variants) of the below tests you wish to run (unskip plus test list must be valid yaml)
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #17020 +/- ##
==========================================
- Coverage 79.06% 79.05% -0.01%
==========================================
Files 1374 1375 +1
Lines 191076 191153 +77
Branches 2465 2465
==========================================
+ Hits 151065 151120 +55
- Misses 30918 30928 +10
- Partials 9093 9105 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
miguelpires
left a comment
There was a problem hiding this comment.
Thanks. This needs a rebase on master though
e73a4a2 to
b8d3586
Compare
|
Failing Tests
These errors are not related to the changes from this PR |
This partly fixes LP2110368 where the download of a private snap's component fails. See the copilot generated overview for more details.
Based on the test results, this fixes the issue of installing components from outside the snap but does not yet resolve the issue of installing components from within the snap using snapctl. That will be then fixed in a follow-up PR.
SNAPDENG-36844